/**
 * 实现fps的计算
 * 创建者：Carburn Ashroom
 * 2022.12.19
 */

#include "fps.h"

namespace Fps {

    void Fps::update_fps()
    {
        if (++frames == interval) {
            auto end = high_resolution_clock::now();
            auto time_l = duration_cast<nanoseconds>(end-start).count();
            start = end;
            present_fps = static_cast<double>(1e9)/time_l*frames;
            frames = 0;
        }
    }

}
